﻿using System.Runtime.Serialization;
using Microsoft.Commerce.Contracts;

namespace MusicWorks.Service.DataContracts
{

    public class HierarchicalCatalogEntity : CatalogEntity
    {
        public const string ModelNameDefinition = "HierarchicalCatalogEntity";

        public HierarchicalCatalogEntity() : base(ModelNameDefinition) { }
        public HierarchicalCatalogEntity(string modelNameDefinition) : base(modelNameDefinition) { }
        public HierarchicalCatalogEntity(CommerceEntity commerceEntity) : base(commerceEntity) { }

        public CommerceRelationship PrimaryParentCategory
        {
            get
            {
                return this.CommerceEntity.GetPropertyValue(RelationshipName.PrimaryParentCategory) as CommerceRelationship;
            }

            set
            {
                this.CommerceEntity.SetPropertyValue(RelationshipName.PrimaryParentCategory, value);
            }
        }

        public CommerceRelationshipList ParentCategories
        {
            get
            {
                return this.CommerceEntity.GetPropertyValue(RelationshipName.ParentCategories) as CommerceRelationshipList;
            }

            set
            {
                this.CommerceEntity.SetPropertyValue(RelationshipName.ParentCategories, value);
            }
        }

        public CommerceRelationship Catalog
        {
            get
            {
                return this.CommerceEntity.GetPropertyValue(RelationshipName.Catalog) as CommerceRelationship;
            }

            set
            {
                this.CommerceEntity.SetPropertyValue(RelationshipName.Catalog, value);
            }
        }

        /// <summary>
        /// Class defining Properties of Items that may be related to a CatalogEntity.
        /// </summary>
        public class RelationshipName
        {
            public const string AncestorCategories = "AncestorCategories";
            public const string BaseCatalog = "BaseCatalog";
            public const string CanonicalCategories = "CanonicalCategories";
            public const string Catalog = "Catalog";
            public const string CrossSells = "CrossSells";
            public const string DiscountDefinitions = "DiscountDefinitions";
            public const string ParentCategories = "ParentCategories";
            public const string PrimaryParentCategory = "PrimaryParentCategory";
            public const string RelatedCategories = "RelatedCategories";
            public const string RelatedProducts = "RelatedProducts";
            public const string UpSells = "UpSells";
        }

        
    }
}